<?php

class ml_biz_userListOutput {
    
    private $aid;
    
    private $aUid = array();
    private $tagList = array();

    
    public function __construct($aUid, $aid = null, $tagList = null){
        
        $this->aUid = $aUid;
        $this->aid = $aid;
        $this->tagList = $tagList;
    }
    
    public function get_nick(){
        
        $aNicks = ml_tool_nick::uids2nicks($this->aUid);
        if (empty($aNicks)) {
            $oAccount = new ml_model_dbUserAccount();
            $rs = $oAccount->getNicksByUids($this->aUid);
            $aNicks = $oAccount->get_data();
        }
        
        return $aNicks;
    }
    
    public function get_cnt()
    {
        $ordsCount= new ml_model_rdsCount();
        
        $cnt_list = $ordsCount->getUserStat($this->aUid);

        return $cnt_list;
    }
    
    
    public function render_html_list()
    {    
        
        $aNicks = $this->get_nick();
        $aCntList = $this->get_cnt();

        $oFollow = new ml_model_dbFollow();
        $oFan = new ml_model_dbFans();

        foreach ($this->aUid as $k)
        {        
            $data[$k]['uid'] = $k;
            $data[$k]['nick'] = $aNicks[$k];
            $data[$k]['followCnt'] = intval($aCntList[$k]['uFC']);
            $data[$k]['fansCnt'] = intval($aCntList[$k]['uFSC']);
            $data[$k]['feedCnt'] = intval($aCntList[$k]['uCC']);
            $data[$k]['attCnt'] = intval($aCntList[$k]['uAttC']);
            $data[$k]['head'] = ml_tool_picid::uid2portrait($k, 'sml');    //头像
            $data[$k]['tag'] = isset($this->tagList[$k]) ? $this->tagList[$k] : '';
            
            $oFollow->isFollow($this->aid, $k);
            $data[$k]['isFollow'] = $oFollow->get_data();
            $oFan->isFan($this->aid, $k);
            $data[$k]['isFan'] = $oFan->get_data();
            $aHtml[] = ml_tool_template::parseModTpl($data[$k], '623');
        }
        
        
        
        return $aHtml;
    }
}